import { getAuthent } from "@/utils/auth";
import { reactive, ref } from "vue";

export default function InitHook() {
  const searchForm = reactive<Partial<MenuManagement.SearchForm>>({
    name: undefined,
    status: undefined,
    clientCode: undefined,
    pageNum: 1,
    pageSize: 20,
    total: 0
  });
  const tableData = ref<Array<MenuManagement.ListRows>>([]);
  const expandRows = ref<Array<Base.GeneraDataType>>(JSON.parse(getAuthent("expandRows") || "[]") || []);
  const tableRef = ref<any>(null);
  const dialogOpts = reactive<Base.DialogOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });
  return {
    searchForm,
    tableData,
    dialogOpts,
    tableRef,
    expandRows
  };
}
